import dynamic from 'dva/dynamic';

// wrapper of dynamic
const dynamicWrapper = (app, models, component) => dynamic({
  app,
  models: () => models.map(m => import(`../models/${m}.js`)),
  component,
});

// nav data  user相关的放在前面，适应router匹配规则
export const getNavData = app => [
  // {
  //   component: dynamicWrapper(app, ['user'], () => import('../layouts/UserLayout')),
  //   layout: 'UserLayout',
  //   path: '/user',
  //   children: [
  //     {
  //       name: '登录',
  //       path: 'login',
  //       component: dynamicWrapper(app, [], () => import('../routes/User/Login')),
  //     },
  //     {
  //       name: '找回密码',
  //       path: 'password',
  //       component: dynamicWrapper(app, [], () => import('../routes/User/Password')),
  //     },
  //     {
  //       name: '注册',
  //       path: 'register',
  //       component: dynamicWrapper(app, [], () => import('../routes/User/Register')),
  //     },
  //   ],
  // },
  {
    component: dynamicWrapper(app, ['app'], () => import('../layouts/IndexLayout')),
    layout: 'Index',
    name: '首页',
    path: '/',
    children: [
      {
        name: '发展部',
        icon: 'bars',
        path: 'development',
        children: [
          {
            name: '委培方管理',
            icon: 'table',
            path: 'client',
            component: dynamicWrapper(app, [], () => import('../routes/Development/Client')),
          },
          {
            name: '意见反馈',
            icon: 'file-text',
            path: 'feedback',
            component: dynamicWrapper(app, [], () => import('../routes/Development/Feedback')),
          },
        ],
      },
      {
        name: '教学部',
        icon: 'bars',
        path: 'teaching',
        children: [
          {
            name: '课程管理',
            icon: 'table',
            path: 'course',
            component: dynamicWrapper(app, [], () => import('../routes/Teaching/Course')),
          },
          {
            name: '师资管理',
            icon: 'file-text',
            path: 'teacher',
            component: dynamicWrapper(app, [], () => import('../routes/Teaching/Teacher')),
          },
          {
            name: '教学管理',
            icon: 'file-text',
            path: 'content',
            component: dynamicWrapper(app, [], () => import('../routes/Teaching/Content')),
          },
          {
            name: '评教管理',
            icon: 'file-text',
            path: 'evaluate',
            component: dynamicWrapper(app, [], () => import('../routes/Teaching/Evaluate')),
          },
        ],
      },
      {
        name: '学员部',
        icon: 'bars',
        path: 'teaching',
        children: [
          {
            name: '学员管理',
            icon: 'table',
            path: 'student',
            component: dynamicWrapper(app, [], () => import('../routes/Student/Student')),
          },
          {
            name: '班级活动管理',
            icon: 'file-text',
            path: 'activity',
            component: dynamicWrapper(app, [], () => import('../routes/Student/Activity')),
          },
          {
            name: '资料管理',
            icon: 'file-text',
            path: 'material',
            component: dynamicWrapper(app, [], () => import('../routes/Student/Material')),
          },
          {
            name: '助教管理',
            icon: 'file-text',
            path: 'assistant',
            component: dynamicWrapper(app, [], () => import('../routes/Student/Assistant')),
          },
          {
            name: '学员评估及意见',
            icon: 'file-text',
            path: 'evaluate',
            component: dynamicWrapper(app, [], () => import('../routes/Student/Evaluate')),
          },
        ],
      },
      {
        name: '综合部',
        icon: 'bars',
        path: 'comprehensive',
        children: [
          {
            name: '学员管理',
            icon: 'table',
            path: 'student',
            component: dynamicWrapper(app, [], () => import('../routes/Comprehensive/Student')),
          },
          {
            name: '酒店管理',
            icon: 'file-text',
            path: 'hotel',
            component: dynamicWrapper(app, [], () => import('../routes/Comprehensive/Hotel')),
          },
          {
            name: '车辆管理',
            icon: 'file-text',
            path: 'vehicle',
            component: dynamicWrapper(app, [], () => import('../routes/Comprehensive/Vehicle')),
          },
          {
            name: '设备管理',
            icon: 'file-text',
            path: 'device',
            component: dynamicWrapper(app, [], () => import('../routes/Comprehensive/Device')),
          },
          {
            name: '财务管理',
            icon: 'file-text',
            path: 'finance',
            component: dynamicWrapper(app, [], () => import('../routes/Comprehensive/Finance')),
          },
          {
            name: '保险管理',
            icon: 'file-text',
            path: 'insurance',
            component: dynamicWrapper(app, [], () => import('../routes/Comprehensive/Insurance')),
          },
        ],
      },
      {
        name: '系统管理',
        icon: 'bars',
        path: 'system',
        children: [
          {
            name: '人事管理',
            icon: 'table',
            path: 'account',
            component: dynamicWrapper(app, [], () => import('../routes/System/Account')),
          },
          {
            name: '权限管理',
            icon: 'file-text',
            path: 'privilege',
            component: dynamicWrapper(app, [], () => import('../routes/System/Privilege')),
          },
          {
            name: '系统设置',
            icon: 'file-text',
            path: 'config',
            component: dynamicWrapper(app, [], () => import('../routes/System/Config')),
          },
          {
            name: '统计分析',
            icon: 'file-text',
            path: 'statistics',
            component: dynamicWrapper(app, [], () => import('../routes/System/Statistics')),
          },

        ],
      },
    ],
  },
];
